#pragma once

#include "xchainedmap.h"

#include "PersistedXamlXmlNamespace.h"
#include "PersistedXamlTypeNamespace.h"
#include "PersistedXamlAssembly.h"
#include "PersistedXamlProperty.h"
#include "PersistedXamlType.h"
#include "XamlAssemblyToken.h"
#include "XamlTypeNamespaceToken.h"
#include "XamlTypeToken.h"
#include "XamlPropertyToken.h"




class XamlAssembly;
class XamlProperty;
class XamlType;
class XamlNamespace;
class XamlText;

class XamlBinaryMetadataStore
{
private: 
	XamlBinaryMetadataStore();
public: 
	static HRESULT Create(xshared_ptr<XamlBinaryMetadataStore> & spXamlBinaryMetadataStore);
	virtual ~XamlBinaryMetadataStore();
	HRESULT GetBinaryMetadata();
	HRESULT WriteMetadata(struct IPALStream * pStream);
	HRESULT GetXamlAssemblyId(const xshared_ptr<XamlAssembly> & inXamlAssembly, XUINT32 & ruiXamlAssemblyId);
	HRESULT GetXamlTypeNamespaceId(const xshared_ptr<XamlNamespace> & inXamlNamespace, XUINT32 & ruiXamlNamespace);
	HRESULT GetXamlTypeId(const xshared_ptr<XamlType> & inXamlType, XUINT32 & ruiXamlTypeId);
	HRESULT GetXamlPropertyId(const xshared_ptr<XamlProperty> & inXamlProperty, XUINT32 & ruiXamlPropertyId);
	HRESULT GetXamlXmlNamespaceId(const xshared_ptr<XamlNamespace> & inXmlNamespace, XUINT32 & ruiXmlNamespace);
	HRESULT GetXamlTextId(const xshared_ptr<XamlText> & inXamlText, XUINT32 & ruiXamlTextId);
	HRESULT GetStringId(const xshared_ptr<CXString> & inString, XUINT32 & ruiStringId);

private: 
	xchainedmap<XamlAssemblyToken,XUINT32> m_mapMasterAssemblyList;  
	xvector<PersistedXamlAssembly> m_vecMasterAssemblyList; 
	xchainedmap<XamlTypeNamespaceToken,XUINT32> m_mapMasterTypeNamespaceList; 
	xvector<PersistedXamlTypeNamespace> m_vecMasterTypeNamespaceList;  
	xchainedmap<XamlTypeToken,XUINT32> m_mapMasterTypeList;  
	xvector<PersistedXamlType> m_vecMasterTypeList; 
	xchainedmap<XamlPropertyToken,XUINT32> m_mapMasterPropertyList;  
	xvector<PersistedXamlProperty> m_vecMasterPropertyList; 
	xchainedmap<xshared_ptr<CXString>,XUINT32> m_mapMasterXmlNamespaceList;
	xvector<PersistedXamlXmlNamespace> m_vecMasterXmlNamespaceList; 
	xchainedmap<xshared_ptr<CXString>,XUINT32> m_mapMasterXamlTextList; 
	xchainedmap<xshared_ptr<CXString>,XUINT32> m_mapStringTable; 
	xvector<xshared_ptr<CXString> > m_vecStringTable; 
};